#include "Loard.h"
#include "Date.h"
#include "Master.h"
#include <QDebug>
#include "arrangement/TaskFactory.h"
#include "Building/City.h"

Loard::Loard()
{
    Master *master=Master::getMaster();
    connect(master->getDate(),SIGNAL(dateSig_firstDayOfTen(Date*)),this,SLOT(assignTask(Date*)));

}

Loard::Loard(const Knight &kinght):Knight(kinght)
{

}

Loard::Loard(const Loard &loard):Knight(loard)
{
}

Loard::~Loard()
{
}

bool Loard::Init(City *city)
{
    Knight::Init(city);
    return true;
}

void Loard::assignTask(Date *date)
{
    City *city=this->m_belongCity;
    QList<Knight *> knights=city->getKnights();
    for(int i=0;i<knights.count();i++)
    {
        Task *task=TaskFactory::createTask(FlgTaskAgricul);
        task->Init(this->m_belongCity,knights.at(i),date->getQDate(),i+1);
        knights.at(i)->recevieTask(task);
    }
}


void Loard::goWork(Date */*date*/)
{
}
